package com.cy.stone.common.base;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.activerecord.Model;
import com.mybatisflex.core.keygen.KeyGenerators;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 实体类公共字段
 *
 * @author Wings
 * @since 2023-12-10
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class BaseEntity {

    /**
     * 主键
     */
    @Schema(description = "主键")
    @Id(keyType = KeyType.Generator, value = KeyGenerators.flexId)
    private String id;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @Column(value = "CREATE_TIME", onInsertValue = "now()")
    private LocalDateTime createTime;

    /**
     * 创建人
     */
    @Schema(description = "创建人")
    @Column(value = "CREATE_BY")
    private String createBy;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    @Column(value = "UPDATE_TIME", onInsertValue = "now()", onUpdateValue = "now()")
    private LocalDateTime updateTime;

    /**
     * 更新人
     */
    @Schema(description = "更新人")
    @Column(value = "UPDATE_BY")
    private String updateBy;

    /**
     * 版本号
     */
    @Schema(description = "版本号")
    @Column(value = "VERSION", version = true)
    private Long version;

    /**
     * 逻辑删除标识【0-未删除 1-已删除】
     */
    @Schema(description = "逻辑删除标识【0-未删除 1-已删除】")
    @Column(value = "IS_DELETED", isLogicDelete = true)
    private String isDeleted;

    /**
     * 状态
     */
    @Schema(description = "状态")
    @Column(value = "STATUS", onInsertValue = "0")
    private String status;

    /**
     * 备注
     */
    @Schema(description = "备注")
    @Column(value = "REMARK")
    private String remark;
}
